package cn.fanxin.tools;

import java.io.*;
import java.util.HashMap;
import java.util.Properties;

/**
 * @Author: china-fanxin
 * @Website: https://fan-xin.cn
 * @Date: 2022/11/19 16:51
 * @Description:
 */
public class CommonTool {


    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description: 加载配置文件信息
     * @Date: 2022/11/23 11:10
     * @Param: [configFilePath]
     * @return: java.util.Properties
     */
    public static Properties loadConfigInfo(String configFilePath){
        Properties configProp;
        //加载配置文件获取配置信息
        InputStream is = null;
        try {
            is = new FileInputStream(new File(configFilePath));
        } catch (FileNotFoundException e) {
            throw new MyException("\n调度错误：\n指定的配置文件不存在");
        }
        configProp = new Properties();
        try {
            configProp.load(is);
        } catch (IOException e) {
            throw new MyException("\n程序出错：\n加载配置文件失败！");
        }
        return configProp;
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description:
     * @Date: 2022/11/19 17:26
     * @Param: [type, info]
     * @return: void
     */
    public static void outputInfoTip(String info){
        System.out.println("提示:"+info+"\r\n"+"===================");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description:
     * @Date: 2022/11/19 17:26
     * @Param: [type, info]
     * @return: void
     */
    public static void outputWarningTip(String info){
        System.out.println("警告:"+info+"\r\n"+"===================");
    }

    /**
     * @Author: china-fanxin
     * @Website: https://fan-xin.cn
     * @Description:
     * @Date: 2022/11/19 17:26
     * @Param: [type, info]
     * @return: void
     */
    public static void outputErrorTip(String info){
        System.out.println("错误提示:"+info+"\r\n"+"===================");
    }
}